import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const routes = [
   {
      path: "/",
      redirect: 'index'
   },
   {
      path: "/index",
      name: "预警总页面",
      component: () => import("@/views/index/index.vue")
   },
   {
      path: "/militaryLogistics",
      name: "扫码页面",
      component: () => import("@/views/militaryLogistics/militaryLogistics.vue")
   },
   {
      path: "/mobileCode",
      name: "手机扫码页面",
      component: () => import("@/views/mobileCode/mobileCode.vue")
   },
   {
      path: "/photograph",
      name: "电脑拍照",
      component: () => import("@/views/photograph/photograph.vue")
   },{
      path: "/alarmConfiguration",
      name: "电脑拍照",
      component: () => import("@/views/alarmConfiguration/alarmConfiguration.vue")
   },
];


const router = new VueRouter({
   routes,
   mode: 'history'
});
router.beforeEach((to, from, next) => {
   document.title = to.name;
   document.body.scrollTop = 0
   // firefox
   document.documentElement.scrollTop = 0
   next()
});

export default router;
